Skip to content

fix: resolve all 16 failing tests across utility library#163

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2468-1779435944
Open

fix: resolve all 16 failing tests across utility library#163
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2468-1779435944

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 22, 2026

Summary

  • calculator.ts: Added division-by-zero guard that throws instead of returning Infinity
  • string-utils.ts: Fixed wordCount to handle multiple consecutive spaces; implemented truncate with word-boundary logic
  • task-manager.ts: Implemented remove, update, and sortBy methods
  • date-utils.ts: Fixed off-by-one in formatRelative by using Math.round instead of Math.floor for day calculation
  • validator.ts: Extended email regex to allow long TLDs (e.g. .museum); extended URL regex to allow port numbers

Test Results

All 60 tests pass (previously 44 passing, 16 failing). No test files were modified.

Assumptions

  • truncate truncates at word boundaries so the result including "..." fits within maxLength
  • sortBy("priority") sorts high > medium > low
  • sortBy("createdAt") sorts oldest first
  • formatRelative uses Math.round for days (36h → 2 days ago)

- calculator: throw on division by zero instead of returning Infinity
- string-utils: fix wordCount to handle multiple spaces, implement truncate
- task-manager: implement remove, update, and sortBy methods
- date-utils: use Math.round for day calculation in formatRelative
- validator: allow long TLDs in email validation, allow ports in URL validation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant